package com.fitns.user.constant;

public enum RedisKey {
	// @formatter:off
	USER("zhhw:userid:user","用户"),
	USER_ID("zhhw:token:userid","用户"),
	URL_CODE_MAP_ROLE_IDS("zhhw:url:code:role:ids","可以访问URL的角色列表"),
	VALIDATE_CODE("zhhw:token:validate:code","验证码"),
	;
    // @formatter:on

	private String prefix;
	private String desc;

	RedisKey(String prefix, String desc) {
		this.prefix = prefix;
		this.desc = desc;
	}

	public String of(String... args) {
		StringBuilder sb = new StringBuilder("woliu:"+prefix);
		for (String arg : args) {
			sb.append(":").append(arg);
		}
		return sb.toString();
	}

	public String ofTms(String... args) {
		StringBuilder sb = new StringBuilder(prefix);
		for (String arg : args) {
			sb.append(":").append(arg);
		}
		return sb.toString();
	}

	public String getPrefix() {
		return prefix;
	}

	public String getDesc() {
		return desc;
	}
}
